
#斐波那契数列
def fib(max):
    n, a, b = 0, 0, 1
    for n in range(max):
        # print(b) #正常的输出
        yield b  #添加上这个就是个生成器了
        a, b = b, a+b
        n+=1
    return 'done'

f = fib(10)
print(f.__next__())
print(f.__next__())
print('---------干点别的事-----------')
print(f.__next__())
print(f.__next__())
print(f.__next__())
print(f.__next__())
